import {http} from "http.js"


//岗位详情页面
function getJobDetail(requestData){
  let hasPublic = getApp().globalData.token?``:`/public`
  return http({
    url:`/api${hasPublic}/recruit/detail`,
    data:{
      "id": requestData ? requestData.id:null,//招聘需求id
      jobType: requestData ? requestData.jobType:1,//工作类型(1,全职 2,兼职)
      lat: requestData ? requestData.lat:null,
      lng: requestData ? requestData.lng:null,
    },
    method:"POST"
  })
}

//岗位详情页 收藏
function jobDetailCollect(requestData){
  return http({
    url:"/api/recruit/collect",
    data:requestData,
    method:"POST"
  })
}


//岗位详情页 岗位推荐
function getJobDetailRecommend(requestData){
  let hasPublic = getApp().globalData.token?``:`/public`
  return http({
    url:`/api${hasPublic}/recruit/list`,
    data:requestData,
    method:"POST"
  })
}

//获取微领队的分享令牌
function othersVvleaderShareToken(requestData){
  let hasPublic = getApp().globalData.token?``:`/public`
  return http({
    url:"/api/public/others_vleader_share_token",
    data:requestData,
    // method:"GET"
  })
}

//生成分享令牌
function createShareToken(requestData){
  let hasPublic = getApp().globalData.token?``:`/public`
  return http({
    url:"/api/share/create_share_token",
    // data:requestData,
    // method:"GET"
  })
}

//校验招聘需求分享有效性 /api/public/check_recruit_share_validity
function checkRecruitShareValidity(requestData){
  let hasPublic = getApp().globalData.token?``:`/public`
  //recruitId 招聘需求id
  //shareToken 分享令牌
  return http({
    url:"/api/public/check_recruit_share_validity",
    data:requestData,
    // method:"GET"
  })
}

//获取后端返回分享生成图片  招聘需求分享信息
function getShareImage(requestData){
  let hasPublic = getApp().globalData.token?``:`/public`
  //id  招聘需求id
  return http({
    url:"/api/public/share_info",
    data:requestData,
    // method:"GET"
  })
}

//申请面试时间展示
function applyTimeDetail(requestData){
  let hasPublic = getApp().globalData.token?``:`/public`
  return http({
    url:"/api/recruit_sign_up/apply_time_detail",
    data:requestData,
    // method:"GET"
  })
}

//申请面试
function applyInterviewConfirm(requestData){
  let hasPublic = getApp().globalData.token?``:`/public`
  return http({
    url:"/api/recruit_sign_up/apply",
    data:requestData,
    // method:"GET"
  })
}

//门店详情页 
function getStoreInfo(requestData){
  let hasPublic = getApp().globalData.token?``:`/public`
  return http({
    url:"/api/public/store/info",
    data:requestData,
    // method:"GET"
  })
}


//获取工作岗位
function getPositionsForRecruit() {
  return http({
    url: '/api/public/positions_for_recruit'
  })
}


module.exports={
  getJobDetail:getJobDetail,
  jobDetailCollect:jobDetailCollect,
  getJobDetailRecommend:getJobDetailRecommend,
  othersVvleaderShareToken:othersVvleaderShareToken,
  checkRecruitShareValidity: checkRecruitShareValidity,
  getShareImage:getShareImage,
  createShareToken: createShareToken,
  getStoreInfo:getStoreInfo,
  applyInterviewConfirm:applyInterviewConfirm,
  applyTimeDetail:applyTimeDetail,
  getPositionsForRecruit: getPositionsForRecruit
}